using System;
using System.Collections.Generic;
using System.Text;

namespace Client
{
    class Message
    {
        private string strMessage = "";
        private string strHeader = "";
        private string strTypeIndentifier = "";
        private string strPrimaryBitMap = "";             //16
        private string strProcessingCode = "";            //6 digit
        private string strResponseCode = "";              //2 digit
        private string strUserID = "";                    //16 digit
        private string strOTPNumber = "";                 //6 digit        
        private string strExtension = "";

        #region GetSet

        public string Content
        {
            get
            {
                strMessage = strHeader + strTypeIndentifier + strPrimaryBitMap + strProcessingCode + strResponseCode + strUserID + strOTPNumber + strExtension;
                return strMessage;
            }
            //set { strMessage = value; }
        }

        public string Header
        {
            get { return strHeader; }
            set { strHeader = value; }
        }

        public string TypeIndentifier
        {
            get { return strTypeIndentifier; }
            set { strTypeIndentifier = value; }
        }
        public string PrimaryBitMap
        {
            get { return strPrimaryBitMap; }
            set { strPrimaryBitMap = value; }
        }

        public string ProcessingCode
        {
            get { return strProcessingCode; }
            set { strProcessingCode = value; }
        }

        public string ResponseCode
        {
            get { return strResponseCode; }
            set { strResponseCode = value; }
        }

        public string UserID
        {
            get { return strUserID; }
            set { strUserID = value; }
        }

        public string OTPNumber
        {
            get { return strOTPNumber; }
            set { strOTPNumber = value; }
        }

        public string Extension
        {
            get { return strExtension; }
            set { strExtension = value; }
        }
        #endregion

        #region Methods
        /// <summary>
        /// input parameter is tcp/ip message that is formated string.
        /// </summary>
        /// <param name="messagetcp"></param>
        public Message(string messagetcp)
        {
            strMessage = "";
            strMessage = messagetcp;
            strHeader = strMessage.Substring(0, 6);
            strTypeIndentifier = strMessage.Substring(6, 4);
            strPrimaryBitMap = strMessage.Substring(10, 16);
            strProcessingCode = strMessage.Substring(26, 6);
            strResponseCode = strMessage.Substring(32, 2);
            strUserID = strMessage.Substring(34, 16);
            strOTPNumber = strMessage.Substring(50, 6);
            strExtension = strMessage.Substring(56);
        }
        /// <summary>
        /// 
        /// </summary>
        public Message()
        {
            strMessage = "";            
            strHeader = "";
            strTypeIndentifier = "";
            strPrimaryBitMap = "";
            strProcessingCode = "";
            strResponseCode = "";
            strUserID = "";
            strOTPNumber = "";
            strExtension = "";
        }
        

        #endregion
    }
}
